{% extends "todolist/base.html" %}
{% block content %}

<form class="row mt-5 justify-content-center" style="border: 0px solid #000;" method="POST">
    {% csrf_token %}
    <div class="col-6">
        <label for="" class="visually-hidden">Password</label>
        <input type="text" class="form-control" name="content" placeholder="what to do">
    </div>
    <div class="col-auto">
        <button type="submit" class="btn btn-primary mb-3">添加</button>
    </div>
</form>

<div class="row justify-content-center">
    <div class="list-group col-7">
        {% if todolist %}
        {% for todo in todolist %}
        <a class="list-group-item list-group-item-action">
            {{todo.content}}
            <div class=" float-end">
                <form action="delete/" method="POST">
                    {% csrf_token %}
                    <input type="hidden" name="delete" value={{todo.id}}>
                    <button class="btn btn-danger btn-sm">
                        删除
                    </button>
                </form>
            </div>

        </a>
        {% endfor %}
        {% else %}
        <a class="list-group-item list-group-item-action">
            没有代办事项
        </a>
        {% endif %}
    </div>
</div>

{% endblock %}